﻿namespace LinesOfAction.Model
{
    using System;
    using System.Collections;

    public class Point : IComparer, ICloneable
    {
        public Point(ushort _x, ushort _y)
        {
            Y = _y;
            X = _x;
        }

        public ushort X { get; set; }
        public ushort Y { get; set; }
        
        public int Compare(object x, object y)
        {
            return x.GetHashCode() - y.GetHashCode();
        }

        public override string ToString()
        {
            return string.Format("{0}{1}",Letter,Number);
        }

        public object Clone()
        {
            return new Point(X, Y);
        }

        protected char Letter
        {
            get { return (char) ('A' + Y); }
        }


        public char Number
        {
            get { return (char)('A' + X); }
        }

        
    }
}
